package com.bkhc.product.entity;

import com.bkhc.common.annotation.Uid;

import com.bkhc.common.listener.DataEntityListener;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 商品对象
 */
@Entity
@Data
@Table(name = "tbl_spec_t")
@EntityListeners({AuditingEntityListener.class, DataEntityListener.class})
public class Spec {
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Id
    private int id ;
    @Uid
    @Column(name = "spec_code")
    private String specCode;
    @Column(name = "product_code")
    private String productCode;

    @Column(name = "spec_name")
    private String specName;

    @Column(name = "remarks")
    private String remarks;

    @Column(name = "status")
    private String status;

    @Transient
    private List<SpecRange> ranges;

    @Column(name = "creator",updatable = false)
    private String creator;

    @Column(name = "create_date",updatable = false)
    @CreatedDate
    private Date createDate;

    @Column(name = "updator")
    private String updator;

    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;

    @Column(name ="sort", columnDefinition="int",nullable = true)
    private Integer sort;

}
